const $http = (url, data = {}, method = 'GET', header = {}) => {
	let baseURL = 'https://www.fastmock.site/mock/b5b84dc2a6df42eb062ed5ee7bd72b4a/uni'
	let promise = new Promise((resolve, reject) => {
		uni.request({
			url: baseURL + url,
			data,
			method,
			header
		}).then(res => {
			if (res[1].data.code === 200) {
				resolve(res[1])
			} else {
				reject(res[1])
			}
		}).catch(err => {
			reject(err)
		})
	})
	return promise
}

export default $http
